<?php
/**
 * Created by PhpStorm.
 * User: dell
 * Date: 2018/4/22
 * Time: 17:36
 */

namespace app\admin\controller;


use think\Controller;

class Base extends Controller
{
    public function _initialize()
    {
        if (empty(session('username')) || empty(session('id'))) {
            $loginUrl = url('Login/index');
            if (request()->isAjax()){
                return msg(111, $loginUrl, '登录超时');
            }
            $this->redirect($loginUrl);
        }

        $this->assign([
           'head' => session('head'),
           'username' => session('username'),
        ]);
    }
}